<?php

//<editor-fold defaultstate="collapsed" desc="License & Copyright">
/*
 * @license
 */

/**
 *
 * @author Jevgeni Geimanen (jevgeni.geimanen@gmail.com)
 */
//</editor-fold>
class SCTextFormField extends FormField {

    
    //<editor-fold defaultstate="collapsed" desc="Multiline">
    /**
     * @var boolean
     */
    private $_Multiline = false;

    /**
     *
     * @return boolean
     */
    public function getMultiline() {
        return $this->_Multiline;
    }

    /**
     *
     * @param boolean $multiline
     * @return Multiline 
     */
    public function setMultiline($multiline) {
        $this->_Multiline = $multiline;
        return $this;
    }

    //</editor-fold>
    
    //<editor-fold defaultstate="collapsed" desc="Overrides">
    public function getMainTagName() {
        return $this->getMultiline() ? "textarea" : parent::getMainTagName();
    }
    protected function CollectMainTagAttributes(&$attributes) {
        $attributes['type'] = 'text';
        if (!$this->getMultiline())
            $attributes['value'] = $this->getValue();
        return parent::CollectMainTagAttributes($attributes);
    }
    
    protected function getHasContents() {
        return $this->getMultiline();
    }
    
    protected function RenderContents() {
        return $this->getValue();
    }

    public function getFieldType() {
        return self::TYPE_TEXT;
    }
    //</editor-fold>

}

?>
